<?php $this->display("objects/breadcrumbs") ?>

<h2><?php _e($object['title']) ?></h2>

<?php if ($oldrevision): ?>
	<h3>Version Comparison</h3>
	
	<p>Comparing original version by <a href="<?php echo Gene::makeLink(Gene::userId($oldrevision['name'])) ?>"><?php _e($oldrevision['name']) ?></a> at <?php echo makedate($oldrevision['rev_time']) ?> with modified version by <a href="<?php echo Gene::makeLink(Gene::userId($revision['name'])) ?>"><?php _e($revision['name']) ?></a> at <?php echo makedate($revision['rev_time']) ?>.</p>
	
	<div class="diffinfo">
	<p><strong>Key:</strong><br /><ins>Inserted Text</ins><br /><del>Deleted Text</del><br />Unchanged Text</p>
	
	<hr />
	
	<p><?php echo nl2br($diff) ?></p>
	</div>
<?php endif; ?>

<?php if ($revision): ?>
	<h3><?php _e($revision['title']) ?></h3>
	<p id="objdesc"><strong><?php _e($revision['description']) ?></strong></p>
	<p class="warning"><strong>This document may contain incorrect or inaccurate information.</strong><br />You are viewing the revision of <?php _e($revision['title']) ?> made by <a href="<?php echo Gene::makeLink(Gene::userId($revision['name'])) ?>"><?php _e($revision['name']) ?></a> at <?php echo makedate($revision['rev_time']) ?>.<br ><a href="<?php echo addArguments(Gene::makeLink(Gene::objectId($object)).'/edit/content', array('revision' => $revision['revision_id'])) ?>">Revert to this version</a>.</p> 

	
	<?php echo $revision['content'] ?>
<?php endif; ?>

<p>This shows previous revisions of <strong><a href="<?php echo Gene::makeLink($object) ?>"><?php _e($object['title']) ?></a></strong>. More recent revisions are shown first.</p>

<form action="<?php echo Gene::makeLink($object); ?>/revisions" method="get">
<input type="hidden" name="s" value="<?php echo $object['object_id'] ?>/revisions" />
<table>
<tr><th></th><th>User</th><th>Date</th><th>Description</th></tr>
<?php foreach ($revisions as $i): ?>
<tr>
<td>
<?php if (count($revisions) > 1): ?>
	<input type="radio" name="oldrevision" value="<?php echo $i['revision_id'] ?>" />
	<input type="radio" name="revision" value="<?php echo $i['revision_id'] ?>" />
<?php endif; ?> 
<strong><a href="<?php echo addArguments(Gene::makeLink($object).'/revisions', array('revision' => $i['revision_id'])); ?>">Show Revision</a></strong></td>
<td><a href="<?php echo Gene::makeLink(Gene::userId($i['name'])) ?>"><?php _e($i['name']) ?></a></td>
<td><?php echo makeDate($i['rev_time']) ?></td>
<td><?php if ($i['rev_minor']): ?>
	<strong>Minor Edit:</strong>
<?php endif; ?>
&nbsp;<em><?php _e($i['rev_summary']) ?></em></td></tr>
<?php endforeach; ?>
</table>

<?php if (count($revisions) > 1): ?>
<p><input type="submit" value="Compare selected versions" /></p>
<?php endif; ?>

</form>
